/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Huu Vinh
 */
@Entity
@Table(name = "Feedback", catalog = "Radio_Cabs", schema = "dbo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Feedback.findAll", query = "SELECT f FROM Feedback f"),
    @NamedQuery(name = "Feedback.findByFBId", query = "SELECT f FROM Feedback f WHERE f.fBId = :fBId"),
    @NamedQuery(name = "Feedback.findByFBContent", query = "SELECT f FROM Feedback f WHERE f.fBContent = :fBContent")})
public class Feedback implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "FBId", nullable = false, length = 8)
    private String fBId;
    @Basic(optional = false)
    @Column(name = "FBContent", nullable = false, length = 2147483647)
    private String fBContent;
    @JoinColumn(name = "FBTypeId", referencedColumnName = "FBTypeId", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private FeedbackType fBTypeId;
    @JoinColumn(name = "AccountId", referencedColumnName = "AccId")
    @ManyToOne(fetch = FetchType.EAGER)
    private Accounts accountId;

    public Feedback() {
    }

    public Feedback(String fBId) {
        this.fBId = fBId;
    }

    public Feedback(String fBId, String fBContent) {
        this.fBId = fBId;
        this.fBContent = fBContent;
    }

    public String getFBId() {
        return fBId;
    }

    public void setFBId(String fBId) {
        this.fBId = fBId;
    }

    public String getFBContent() {
        return fBContent;
    }

    public void setFBContent(String fBContent) {
        this.fBContent = fBContent;
    }

    public FeedbackType getFBTypeId() {
        return fBTypeId;
    }

    public void setFBTypeId(FeedbackType fBTypeId) {
        this.fBTypeId = fBTypeId;
    }

    public Accounts getAccountId() {
        return accountId;
    }

    public void setAccountId(Accounts accountId) {
        this.accountId = accountId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (fBId != null ? fBId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Feedback)) {
            return false;
        }
        Feedback other = (Feedback) object;
        if ((this.fBId == null && other.fBId != null) || (this.fBId != null && !this.fBId.equals(other.fBId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.Feedback[ fBId=" + fBId + " ]";
    }
    
}
